/**
 * Yolema.com Inc.
 * Copyright (c) 2011-2012 All Rights Reserved.
 */
package org.grayrabbit.pay.core.service.system.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.grayrabbit.pay.core.model.pages.PageList;
import org.grayrabbit.pay.core.model.pages.PageTools;
import org.grayrabbit.pay.core.service.system.AssAppsystemTradeterminalService;
import org.grayrabbit.pay.core.dao.system.AssAppsystemTradeterminalDao;
import org.grayrabbit.pay.core.model.entity.system.AssAppsystemTradeterminal;

/**
 * 
 * 
 * @author liyd
 * @version $Id: AssAppsystemTradeterminalServiceImpl.java, v 0.1 Fri Jun 01 11:14:02 CST 2012 liyd Exp $
 */
@Component
public class AssAppsystemTradeterminalServiceImpl implements AssAppsystemTradeterminalService {

    @Autowired
    private AssAppsystemTradeterminalDao assAppsystemTradeterminalDao;

    /**
     * 查询业务对象列表
     * 
     * @param assAppsystemTradeterminal
     * @return
     */
    public PageList<AssAppsystemTradeterminal> queryPageList(AssAppsystemTradeterminal assAppsystemTradeterminal) {

        PageTools pageTools = new PageTools();
        pageTools.setPage(assAppsystemTradeterminal.getPageNum());
        pageTools.setItemsPerPage(assAppsystemTradeterminal.getPageSize());

        Map<String, Object> params = new HashMap<String, Object>();

        params.put("query", assAppsystemTradeterminal);
        params.put("startRow", pageTools.getBeginIndex());
        params.put("pageSize", pageTools.getItemsPerPage());

        pageTools.setItems(assAppsystemTradeterminalDao.queryCount(params));

        PageList<AssAppsystemTradeterminal> pageList = new PageList<AssAppsystemTradeterminal>();
        pageList.addAll(assAppsystemTradeterminalDao.queryPageList(params));
        pageList.setPageTools(pageTools);

        return pageList;

    }

    /**
     * 根据Id得到实体对象
     * 
     * @param id
     * @return
     */
    public AssAppsystemTradeterminal getById(Long id) {

        return assAppsystemTradeterminalDao.getById(id);
    }

    public List<Long> findBySystemId(Long id) {

        return assAppsystemTradeterminalDao.getBySystemId(id);
    }

    public List<Long> findByTerminalId(Long id) {

        return assAppsystemTradeterminalDao.getByTerminalId(id);
    }

    /**
     * 根据id批量删除
     * 
     * @param idArray
     */
    public void deleteBatchById(Long[] idArray) {
        assAppsystemTradeterminalDao.deleteBatchById(idArray);
    }

    public void deleteBatchBySystemIds(Long[] systemId) {
        assAppsystemTradeterminalDao.deleteBatchBySystemIds(systemId);
    }

    public void deleteBatchBySystemId(Long systemId) {
        assAppsystemTradeterminalDao.deleteBatchBySystemId(systemId);
    }

    /**
     * 查询所有对象
     * 
     * @return
     */
    public List<AssAppsystemTradeterminal> findAll() {
        return assAppsystemTradeterminalDao.findAll();
    }

    /**
     * 添加一个对象
     * 
     * @param assAppsystemTradeterminal
     */
    public void insert(AssAppsystemTradeterminal assAppsystemTradeterminal) {

        assAppsystemTradeterminalDao.save(assAppsystemTradeterminal);

    }

    /**
     * 更新一个对象
     * 
     * @param assAppsystemTradeterminal
     * @return
     */
    public int update(AssAppsystemTradeterminal assAppsystemTradeterminal) {

        return assAppsystemTradeterminalDao.update(assAppsystemTradeterminal);

    }

    /**
     * 删除一个对象
     * 
     * @param assAppsystemTradeterminal
     */
    public void delete(AssAppsystemTradeterminal assAppsystemTradeterminal) {
        assAppsystemTradeterminalDao.delete(assAppsystemTradeterminal);
    }

}
